#!/usr/bin/python
# -*- coding:utf-8 -*-
# @FileName : python_test10_10.py
# Author    : myh

# 练习 10.10：常见单词　访问古登堡计划，找一些你想分析的图书。下
# 载这些作品的文本文件或将浏览器中的原始文本复制到文本文件中。
from pathlib import Path

path = Path('Town strike by Agnes Giberne.txt')

contents = path.read_text(errors='ignore')
lines = contents.splitlines()

num = 0
for line in lines:
    num += line.lower().count('the')

print(num)

num = 0
for line in lines:
    num += line.lower().count('then')

print(num)

num = 0
for line in lines:
    num += line.lower().count('there')

print(num)
